package org.swidgets.base.sinputbox;

import com.google.gwt.core.client.JavaScriptObject;

public class RegExp extends JavaScriptObject {

	private final JavaScriptObject nativePeer;

	private RegExp(JavaScriptObject nativePeer) {
		super();

		this.nativePeer = nativePeer;
	}

	public static RegExp create(String exp) {
		return new RegExp(createNative(exp));
	}

	private static native JavaScriptObject createNative(String exp)/*-{ 
		 return new $wnd.RegExp(exp); 
	}-*/;

	public boolean test(String sToMatch) {
		return test(nativePeer, sToMatch);
	}

	private static native boolean test(JavaScriptObject self, String sToMatch)/*-{ 
		 return self.test(sToMatch); 
	}-*/;

}
